'use strict';

module.exports = app => {
    const { Sequelize, model } = app

    const Model = model.define('minaPartnerMoneyTrace', {
        id:{
            type: Sequelize.STRING.BINARY,
            defaultValue: Sequelize.UUIDV1,
            primaryKey: true
        },
        trade: {
            type: Sequelize.INTEGER(8),
            allowNull: false,
        },
        balance: {
            type: Sequelize.INTEGER(8),
            allowNull: false,
        },
        remark: {
            type: Sequelize.STRING,
            allowNull: false,
        },
        source: {
            type: Sequelize.INTEGER(4),
            allowNull: false,
        },
    }, {
        freezeTableName: true,
        tableName: 'mina_partner_money_trace',
    })

    Model.associate = function() {
        model.MinaPartnerMoneyTrace.belongsTo(model.MinaPartner)
        model.MinaPartner.hasMany(model.MinaPartnerMoneyTrace)
    }

    return Model
}